#include "TulingGenQrCode.h"
#include "TulingConfig.h"
#include <stdlib.h>

#include "cJson.h"
#include <stdio.h>
#include <string.h>
#include "TCPSocket.h"
#include "WiFiStackInterface.h"



int GenQrCode(char * strQrInfo)
{
	TulingConfig::Instance().ReadData();
	TulingProfile * pProfile = (TulingProfile *)TulingConfig::Instance().GetProfile();
	if(pProfile==NULL)return -1;
	cJSON *root = NULL;	
	root = cJSON_CreateObject();
	cJSON_AddStringToObject(root,"apiKey",pProfile->AC_wificfg.strApiKey);
	cJSON_AddStringToObject(root,"deviceId",pProfile->AC_wificfg.strDeviceID);
	char * strJson = cJSON_Print(root);
	memcpy(strQrInfo,strJson,strlen(strJson));
	cJSON_Delete(root);
	free(strJson); 
	return 0;
}

